import Vue from "vue";
import Router from "vue-router";

Vue.use(Router);

const constRouter = [
    {
        path: "*",
        redirect: "/index",
    },
    {
        path: "/index",
        component: resolve => require(["@/views/index.vue"], resolve),
        name: "homePage",
    },
    {
        path: "/light",
        component: resolve => require(["@/views/light.vue"], resolve),
        name: "lightPage",
    },
    {
        path: "/de-noise",
        component: resolve => require(["@/views/deNoise.vue"], resolve),
        name: "deNoise",
    },

    // 自定义页面路由，不需要显示左部菜单页面

    // 页面调试使用，线上使用菜单配置数据

];

const router = new Router({
    scrollBehavior: () => ({ y: 0 }),
    routes: constRouter
});

const whiteList = ["/index"];

// 异步的路由信息， 同时，左侧菜单也会根据这个来显示
let asyncRouter;

// 导航守卫，渲染动态路由
router.beforeEach((to, from, next) => {
    next()
});

router.afterEach(() => {
});



function view(path) {
    return function (resolve) {
        require([`@/views/${path}.vue`], resolve);
    };
}

export default router;
